#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "qlistview.h"
#include "qsplitter.h"

#include "scriptviewer.h"
#include "ActionListView.h"
#include "FileInport.h"
#include "qgridlayout.h"
#include "qlayout.h"
#include "QLabel"

#include <QDragEnterEvent>
#include <QDropEvent>
#include <QToolBar>

#include "qtranslator.h"

class PlaylistFunction;
class LightPresetModel;
class MediaListModel;
class ApplicationSettings;

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
   Q_OBJECT

public:
   explicit MainWindow( FileInport  &fileInport,
                        ApplicationSettings & applicationSettings,
                        QWidget *parent = 0);
   ~MainWindow();

   QWidget *sequenceFunctionArea();
   QWidget *scriptArea();
   QLayout *playlistArea();
   QLayout *lightControlArea();
   QBoxLayout *volumeSliderArea();

   void setMediaListActions( QList<QAction *> & actions);
   void setLightControlActions(QList<QAction *> & actions);
   void setSequenceActions( QList<QAction *> & actions);
   void setScriptActions(const QList<QAction *> &actions);

   void openApplicationArguments();

signals:
   void saveShowTriggered();
   void saveShowAsTriggered();
   void openShowTriggered();
   void loadShowFile(const QString &);
   void mainWindowAboutToClose();

protected:
   virtual void dragEnterEvent ( QDragEnterEvent * e );
   virtual void dropEvent ( QDropEvent * e );
   virtual void closeEvent(QCloseEvent *);

private:
   void setup_gui_elems();
   void setup_drop_function();
   void createRecentShowActions();
   void connect_actions();
   void load_action_icons();
   void attachIcon( QAction *action, const QString &icon_filename);
   void retrieve_gui_elements();
   void loadApplicationLanguage();
   int askToSave();

private:
   Ui::MainWindow *ui;

   QLayout  *ui_volumeBarLayout;

   FileInport  &m_fileInport;
   ApplicationSettings & m_applicationSettings;
   QTranslator appTranslator;

   // toolbars
   QToolBar    *ui_script_anim_toolbar;
   QToolBar    *ui_script_toolbar;
   QToolBar    *ui_music_toolbar;

   QList<QAction *> m_recentShowActions;


private slots:
   void onShowNameChanged(const QString &filename);
   void onShowChanged();
   void onShowSaved(const QString &showPath);
   void loadStyleSheet(const QString &);
   void onRecentShowsChanged();
   void openRecentShow();

private slots:
   void on_action_Dark_Mode_triggered(bool checked);
   void on_actionLocale_triggered(bool checked);
   void on_actionAbout_MeTeOr_Player_triggered();
   void on_actionOpenCurtain_triggered();
   void on_actionCloseCurtain_triggered();
};

#endif // MAINWINDOW_H
